class Solution
{
public:
    bool halvesAreAlike(string s)
    {
        const unordered_set<char> vowels{'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'};
        int vowelCount = 0;
        int n = s.size() / 2;
        for (int i = 0; i < n; ++i)
        {
            if (vowels.count(s[i]))
            {
                ++vowelCount;
            }
            if (vowels.count(s[i + n]))
            {
                --vowelCount;
            }
        }
        return vowelCount == 0;
    }
};